package cc.ilzy.mall.model.vo;

import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.experimental.Accessors;

import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;

@ApiModel(value = "购物车商品项目", description = "购物车商品项目")
@Data
@Accessors(chain = true)
public class CartItemVO implements Serializable {

    @Serial
    private static final long serialVersionUID = 1L;

    @ApiModelProperty("购物车商品明细id")
    private Long productId;

    @ApiModelProperty("要购买数量")
    private Integer buyNum;

    @ApiModelProperty("商品标题")
    private String productTitle;


    @ApiModelProperty("商品图片")
    private String productImg;

    @ApiModelProperty("商品单价")
    private BigDecimal amount;

    @ApiModelProperty("商品总价")
    private BigDecimal totalAmount;


    public BigDecimal getTotalAmount() {
        return amount.multiply(new BigDecimal(buyNum));
    }
}
